<template>
  <div style="margin: auto;margin-top: -55px">
    <div style="height: 20px">
      <div style="float:left;margin-left:20px" @click="my()">
        <i style="margin-left: 0px" class="el-icon-back"></i>
      </div>
    </div>
    <div style="height: 45px;background-color: #02A774;margin-top: 0px">
      <font color="#f0f8ff" size="5px" style="margin: 0 auto;">购物车</font>
    </div>
    <div style="height: 10px">
    </div>
    <el-row :gutter="20">
      <el-col :span="6"><div class="grid-content bg-purple">名称</div></el-col>
      <el-col :span="6"><div class="grid-content bg-purple">个数</div></el-col>
      <el-col :span="6"><div class="grid-content bg-purple">单价</div></el-col>
      <el-col :span="6"><div class="grid-content bg-purple">小计</div></el-col>
    </el-row>
    <p v-for="(lm,i) in list">
      <el-row :gutter="20">
        <el-col :span="6"><div class="grid-content bg-purple">{{lm.g_name}}</div></el-col>
        <el-col :span="6"><div class="grid-content bg-purple">{{lm.c_goodsnumber}}</div></el-col>
        <el-col :span="6"><div class="grid-content bg-purple">{{lm.g_price}}</div></el-col>
        <el-col :span="6"><div class="grid-content bg-purple">{{lm.c_goodssubtotal}}</div></el-col>
      </el-row>
    </p>

    <div style="height: 50px" class="fixed">
      <div style="float: right;margin-right: 5px;margin-top: 8px">
        <el-row>
          <el-button type="primary" style="height: 100%" @click="jieSuan()">结算</el-button>
        </el-row>
      </div>
    </div>
  </div>
</template>

<script>
  import axios from "axios";
  export default {
    data() {
      return {
        tableData: [{
          g_name: '2016-05-02',
          c_goodsnumber: '王小虎',
          g_price: '上海市普陀区金沙江路 1518 弄',
          c_goodssubtotal:''
        }],
        list:[{
          g_name: "",
          g_price:0,
          c_goodsnumber: 0,
          c_goodssubtotal: 0
        }]
      }
    },
    methods:{
      selMyCart(){
        var _this = this;
        axios.get("/vip/CartController/selAllCart").then(function (res) {
          _this.list = res.data;
        })
      },
      jieSuan(){
        this.$router.push({name:"myOrder"})
      },
      my(){
        this.$router.push({name:"waimai"});
      },
    },
    mounted(){
      this.selMyCart();
    }
  }
</script>

<style scoped>
  .el-row {
    margin-bottom: 20px;
  &:last-child {
     margin-bottom: 0;
   }
  }
  .el-col {
    border-radius: 4px;
  }
  .bg-purple-dark {
    background: #99a9bf;
  }
  .bg-purple {
    background: #d3dce6;
  }
  .bg-purple-light {
    background: #e5e9f2;
  }
  .grid-content {
    border-radius: 4px;
    min-height: 36px;
  }
  .row-bg {
    padding: 10px 0;
    background-color: #f9fafc;
  }
  /*将div固定底部  css*/
  .fixed{ position:fixed;
    left:0px;
    bottom:0px;
    width:100%;
    height:50px;
    background-color:darkseagreen;
    z-index:9999;
  }
</style>
